'use strict';

module.exports = {
  up: async (queryInterface, Sequelize) => {
     await queryInterface.createTable('login-log', {
      id: {
        allowNull: false,
        autoIncrement: true,
        primaryKey: true,
        type: Sequelize.INTEGER,
        comment: 'id'
      },
      user_id: {
        type: Sequelize.INTEGER,
        allowNull: false,
        defaultValue: 0,
        comment: '用户id'
      },
      login_ip_at: {
        type: Sequelize.CHAR(15),
        allowNull: false,
        field: 'login_ip_at',
        defaultValue: '',
        comment: '用户登录的ip地址'
      },
      login_at: {
        allowNull: false,
        type: Sequelize.DATE,
        filed: 'login_at',
        comment: '用户登录的时间'
      }
      }, {
        tableName: 'login-log',
        charset: 'utf8mb4',
        collate: 'utf8mb4_bin',
        indexes: [
          {

          }
        ]
    });
  },

  down: async (queryInterface, Sequelize) => {
     await queryInterface.dropTable('login-log');
  }
};
